package cn.tedu.luban.order.main.consumer;

import cn.tedu.luban.order.main.service.OrderService;
import com.tedu.inn.protocol.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@RocketMQMessageListener(topic = "order_complete_topic",consumerGroup = "order_complte_group02")
public class OrderCompleteConsumer implements RocketMQListener<String> {
    @Autowired
    private OrderService orderService;
    @Override
    public void onMessage(String orderNo) {
        try{
            orderService.orderComplete(orderNo);
        }catch (BusinessException e){
            log.error("订单完结失败",e);
        }
    }
}
